package homework0302;

import java.util.ArrayList;
import java.util.Collection;

public class CollectionDemo1 {
    public static void main(String[] args) {
        Collection c=new ArrayList();
        c.add(new Point(1,2));
        c.add(new Point(3,4));
        c.add(new Point(5,6));
        c.add(new Point(7,8));
        c.add(new Point(9,0));
        c.add(new Point(1,2));

        Point p=new Point(1,2);
        System.out.println(c);
        System.out.println(c.contains(p));//ture
        c.remove(p);//删除两个集合中给定元素equals比较为true的元素，只删除一次
        System.out.println(c);

        c.add(p);
        System.out.println(c);//将p添加到集合c的末尾
        p.setY(10);
        System.out.println(p);
        System.out.println(c);

        System.out.println(c.size());
        System.out.println(c.isEmpty());//false
        c.clear();//清空集合
        System.out.println(c);//[]



    }
}
